let express = require('express')
let router = express.Router();
let { uploadFiles } = require('../utils/handFiles')


router.post('/uploadImages', function(req, res, next) {
    let images = uploadFiles({
        path: './public/temp',
        key: 'file',
        size: 10000
    });
    images(req, res, (err) => {
        if (err) {
            console.log('图片上传失败', err);
        } else {
            console.log('图片上传成功');
            // console.log(req.files);
            res.send({
                msg: '图片上传成功',
                code: 1,
                data: req.files[0].filename
            })
        }
    })
})
router.get('/getImg', function (req, res, next) {
    console.log(req.body)
    return
    res.sendFile(path.join(__dirname, `public/template/${req.body}`));
})
module.exports = router